package com.team.employment.web.admin.controller.user;

import com.team.employment.common.result.Result;
import com.team.employment.model.enums.UserType;
import com.team.employment.web.admin.service.UserInfoService;
import com.team.employment.web.admin.vo.UserTypeVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@Tag(name = "用户类型管理")
@RestController
@RequestMapping("/admin/userType")
public class UserTypeController {

    @Operation(summary = "查询所有用户类型")
    @GetMapping("getUserType")
    public Result<List<UserTypeVo>> getUserType(){
        ArrayList<UserTypeVo> userTypeVos = new ArrayList<>();
        for (UserType userType:UserType.values()){
            UserTypeVo vo = UserTypeVo.builder().code(userType.getCode()).name(userType.getName()).build();
            userTypeVos.add(vo);
        }
        return Result.ok(userTypeVos);
    }
}
